﻿<%@ Page Language="VB" MasterPageFile="~/ZayedHouse.master" AutoEventWireup="false"
    CodeFile="MaterialRequest.aspx.vb" Inherits="Processes_Storing_MaterialRequest"
    Title="Untitled Page" %>

<%@ Register Src="../../../UserControl/OneFilteredDropDownList.ascx" TagName="OneFilteredDropDownList"
    TagPrefix="uc2" %>
<%@ Register Src="../../../UserControl/DDL.ascx" TagName="WebUserControl" TagPrefix="uc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CPH1" runat="Server" >


    <table style="table-layout: fixed; ">
        <tr>
            <td style="width: 75px">
                <asp:Label ID="lblDate" meta:resourceKey="lblDate" runat="server"></asp:Label></td>
            <td>
                <telerik:RadDateInput ID="rdiDate" runat="server" ReadOnly="True" SkinID="EnterDate"
                    Enabled="False" TabIndex="-1" >
                </telerik:RadDateInput></td>
            <td>
                <asp:Label ID="lblID" meta:resourceKey="lblID" runat="server"></asp:Label></td>
            <td>
                <telerik:RadTextBox ID="rtxtID" runat="server" SkinID="Text" Enabled="False" >
                </telerik:RadTextBox></td>
            <td>
            </td>
        </tr>
        <tr>
            <td style="width: 75px">
                <asp:Label ID="lblEmpName" meta:resourceKey="lblEmpName" runat="server"></asp:Label></td>
            <td>
                <telerik:RadTextBox ID="rtxtEmpName" runat="server" SkinID="Text" Enabled="False">
                </telerik:RadTextBox>
            </td>
            <td>
                <asp:Label ID="lblSection" meta:resourceKey="lblDepartment" runat="server"></asp:Label></td>
            <td>
                <telerik:RadTextBox ID="rtxtSection" runat="server" SkinID="Text" Enabled="False">
                </telerik:RadTextBox>
                                <asp:RequiredFieldValidator ID="rfvrtxtSection" runat="server" ControlToValidate="rtxtSection"
                    ErrorMessage="<%$ Resources:Controls, RequiredValidationText %>" ValidationGroup="Submit"></asp:RequiredFieldValidator>
                </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblCostCenter" meta:resourceKey="lblCostCenter" runat="server"></asp:Label></td>
            <td>
                <uc2:OneFilteredDropDownList ID="fddlCostCenter" runat="server" DataSourceId="ODSRetrieveCostCenter"
                    DataTextField="<%$ Resources:MainGrid ,FDDLCostCenter %>" DataValueField="CostCenterNo"
                    DefaultChoosedItem="ChooseOne" IsRequired="false" />
                <asp:ObjectDataSource ID="ODSRetrieveCostCenter" runat="server" SelectMethod="QueryDatabase"
                    TypeName="CL_ORM.DBWFRetrieveSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RetrieveAllCostCenter" Name="Operation" Type="String" />
                        <asp:Parameter Name="CostCenterNo" Type="String" />
                        <asp:Parameter Name="ProgramNO" Type="String" />
                        <asp:Parameter Name="ProjectNO" Type="String" />
                        <asp:Parameter Name="lEVEL" Type="String" />
                        <asp:Parameter Name="ItemNo" Type="String" />
                        <asp:Parameter Name="FParmeter" Type="String" />
                        <asp:Parameter Name="SParmeter" Type="String" />
                        <asp:Parameter Name="TParmeter" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </td>
            <td>
                <asp:Label ID="lblMainCostCenter" meta:resourceKey="lblMainCostCenter" runat="server"></asp:Label></td>
            <td>
                <telerik:RadTextBox ID="rtxtRootCostCenter" runat="server" SkinID="Text" Enabled="False"
                    TabIndex="-1">
                </telerik:RadTextBox></td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblDateOfSupply" meta:resourceKey="lblDateOfSupply" runat="server"></asp:Label></td>
            <td>
                <telerik:RadDatePicker ID="rdpDateOfSupply" runat="server" SkinID="Date" Skin="WebBlue">
                </telerik:RadDatePicker>
                <asp:RequiredFieldValidator ID="rfvDateOfSupply" runat="server" ControlToValidate="rdpDateOfSupply"
                    ErrorMessage="<%$ Resources:Controls, RequiredValidationText %>" ValidationGroup="Submit"></asp:RequiredFieldValidator></td>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td colspan="5">
                <telerik:RadGrid ID="rgMat" runat="server" GridLines="None" DataSourceID="SessionDataSource1"
                    AllowAutomaticDeletes="True" AllowAutomaticInserts="True" Width="97%" AllowAutomaticUpdates="True"
                    AutoGenerateColumns="False" Skin="WebBlue" MasterTableView-Dir="<%$ Resources:SystemResource, HTMLDirectionality %>"
                    GroupPanel-Text="<%$ Resources:Grid ,GroupPanelText %>">
                    <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="IDNO"
                        TableLayout="Fixed" DataSourceID="SessionDataSource1" HorizontalAlign="NotSet"
                        NoMasterRecordsText="<%$ Resources:Grid , NoMasterRecordsText %>">
                        <CommandItemTemplate>
                         <asp:ImageButton  id="imgInitInsert" CommandName="InitInsert"  runat="server"  ImageUrl="../../../images/Grid/AddRecord.gif"  />                          
                            &nbsp;&nbsp;
                             <asp:LinkButton ID="btnInitInsert" runat="server" Font-Size="Large" Text="<%$ Resources:Grid , AddNew %>"
                                CommandName="InitInsert" Visible="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <asp:ImageButton  id="imgEditSelected" CommandName="EditSelected"  runat="server"  ImageUrl="../../../images/Grid/Edit.gif"  />
                            &nbsp;&nbsp;
                            <asp:LinkButton ID="btnEditSelected" runat="server" Font-Size="Large" Text="<%$ Resources:Grid , EditSelected %>"
                                CommandName="EditSelected" Visible="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <asp:ImageButton  id="imgDeleteSelected" CommandName="DeleteSelected"  runat="server"  ImageUrl="../../../images/Grid/Delete.gif"  />&nbsp;&nbsp;
                            <asp:LinkButton
                                ID="btnDeleteSelected" Font-Size="Large" OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>"
                                runat="server" Text="<%$ Resources:Grid , DeleteSelected %>" CommandName="DeleteSelected" />&nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <asp:ImageButton  id="imgRebindGrid" CommandName="DeleteSelected"  runat="server"  ImageUrl="../../../images/Grid/Refresh.gif"  />&nbsp;&nbsp;
                            <asp:LinkButton
                                ID="btnRebindGrid" Font-Size="Large" runat="server" Text="<%$ Resources:Grid , Refresh %>"
                                CommandName="RebindGrid" />
                        </CommandItemTemplate>
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton">
                                <ItemStyle CssClass="MyImageButton" />
                                <HeaderStyle Width="50px" />
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn DataField="IDNO" HeaderText="IDNO" ReadOnly="True" SortExpression="IDNO"
                                UniqueName="IDNO" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="TransYear" HeaderText="TransYear" ReadOnly="True"
                                SortExpression="TransYear" UniqueName="TransYear" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="OrderNo" HeaderText="OrderNo" ReadOnly="True"
                                SortExpression="OrderNo" UniqueName="OrderNo" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ProgNO" HeaderText="<%$ Resources:MainGrid , ProgNO %>"
                                SortExpression="ProgNO" UniqueName="ProgNO">
                                <HeaderStyle Width="50px" />
                                <ItemStyle Width="50px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridDropDownColumn DataField="ProgNO" DataSourceID="ODSProgram" HeaderText="<%$ Resources:MainGrid , Program %>"
                                ListTextField="ProgDesc" ListValueField="ProgNO" UniqueName="ProgNO" EnableEmptyListItem="True">
                                <HeaderStyle Width="200px" />
                                <ItemStyle Width="200px" />
                            </telerik:GridDropDownColumn>
                            <telerik:GridBoundColumn DataField="ProjectNO" HeaderText="<%$ Resources:MainGrid , ProjectNo %>"
                                SortExpression="ProjectNO" UniqueName="ProjectNO">
                                <HeaderStyle Width="50px" />
                                <ItemStyle Width="50px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridDropDownColumn DataField="ProjectNO" DataSourceID="ODSProject" HeaderText="<%$ Resources:MainGrid , Project %>"
                                ListTextField="ProjDesc" ListValueField="ProjectNO" UniqueName="ProjectNO" EnableEmptyListItem="True">
                                <HeaderStyle Width="100px" />
                                <ItemStyle Width="100px" />
                            </telerik:GridDropDownColumn>
                            <telerik:GridBoundColumn DataField="ItemNo" HeaderText="<%$ Resources:MainGrid , ItemNo %>"
                                SortExpression="ItemNo" UniqueName="ItemNo">
                                <HeaderStyle Width="50px" />
                                <ItemStyle Width="50px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridDropDownColumn DataField="ItemNo" DataSourceID="ODSItem" HeaderText="<%$ Resources:MainGrid , Item %>"
                                ListTextField="ItemName" ListValueField="ItemNo" UniqueName="ItemNo" EnableEmptyListItem="True">
                                <HeaderStyle Width="100px" />
                                <ItemStyle Width="100px" />
                            </telerik:GridDropDownColumn>
                            <telerik:GridBoundColumn DataField="ItemDesc" HeaderText="<%$ Resources:MainGrid , ItemDesc %>"
                                SortExpression="ItemDesc" UniqueName="ItemDesc">
                                <HeaderStyle Width="100px" />
                                <ItemStyle Width="100px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="UnitNo" HeaderText="<%$ Resources:MainGrid , UnitNo %>"
                                SortExpression="UnitNo" UniqueName="UnitNo" Visible="False">
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridDropDownColumn DataField="UnitNo" DataSourceID="ODSAllUnits" HeaderText="<%$ Resources:MainGrid , Unit %>"
                                ListTextField="UnitDesc" ListValueField="UnitNo" UniqueName="UnitNo" EnableEmptyListItem="True">
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridDropDownColumn>
                            <telerik:GridNumericColumn DataField="Qty" meta:resourceKey="Qty" DataFormatString="{0:###,###}"
                                HeaderText="Qty" SortExpression="Qty" UniqueName="Qty" EditFormColumnIndex="1"
                                NumericType="Number">
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridNumericColumn>
                            <telerik:GridNumericColumn DataField="AmountDisburse" meta:resourceKey="AmountDisburse"
                                DataFormatString="{0:###,###}" HeaderText="AmountDisburse" SortExpression="AmountDisburse"
                                UniqueName="AmountDisburse" EditFormColumnIndex="1" NumericType="Number">
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridNumericColumn>
                            <telerik:GridCalculatedColumn DataFields="Qty,AmountDisburse" Expression="{0}-{1}"
                                Aggregate="Sum" meta:resourceKey="AmountRemains" UniqueName="AmountRemainsCalc"
                                DataFormatString="{0:###,###}" DataType="System.Double">
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridCalculatedColumn>
                            <telerik:GridCheckBoxColumn DataField="IsComplete" meta:resourceKey="IsComplete"
                                UniqueName="IsComplete">
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridCheckBoxColumn>
                            <telerik:GridNumericColumn DataField="AvalAmount"   meta:resourceKey="AvalAmount"   DataFormatString="{0:###,###}" 
                                SortExpression="AvalAmount" UniqueName="AvalAmount" EditFormColumnIndex="1" NumericType="Number"  >
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridNumericColumn>
                            <telerik:GridNumericColumn DataField="AmountPurchase" meta:resourceKey="AmountPurchase"
                                DataFormatString="{0:###,###}" SortExpression="AmountPurchase" UniqueName="AmountPurchase"
                                EditFormColumnIndex="1" NumericType="Number">
                                <HeaderStyle Width="70px" />
                                <ItemStyle Width="70px" />
                            </telerik:GridNumericColumn>
                            <telerik:GridBoundColumn DataField="Note" HeaderText="<%$ Resources:MainGrid , Note %>"
                                UniqueName="Note">
                                <HeaderStyle Width="200px" />
                                <ItemStyle Width="200px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridButtonColumn ConfirmText="<%$ Resources:MainGrid , ConfirmDelete %>"
                                ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                                <HeaderStyle Width="50px" />
                                <ItemStyle Width="50px" HorizontalAlign="Center" CssClass="MyImageButton" />
                            </telerik:GridButtonColumn>
                        </Columns>
                        <EditFormSettings EditFormType="Template">
                            <FormTemplate>
                                <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none"
                                    style="border-collapse: collapse; background: white;">
                                    <tr class="EditFormHeader">
                                        <td colspan="2" style="font-size: small">
                                            <b>
                                                <asp:Label ID="lblDescription" meta:resourceKey="lblDescription" runat="server"></asp:Label>
                                            </b>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="1">
                                            <b>
                                                <asp:Label ID="lblSpecification" meta:resourceKey="lblSpecification" runat="server"></asp:Label></b></td>
                                        <td colspan="1">
                                            <b>
                                                <asp:Label ID="lblAmounts" meta:resourceKey="Amounts" runat="server"></asp:Label></b></td>
                                    </tr>
                                    <tr>
                                        <td colspan="1" style="width: 500px">
                                            <table id="Table3" cellspacing="1" cellpadding="1" width="500" border="0" class="module">
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtProgNo" Text="<%$ Resources:MainGrid, ProgNo %>" runat="server"></asp:Label></td>
                                                    <td>
                                                        <uc1:WebUserControl ID="WUCProg" IsRequired="false" runat="server" DataSourceId="ODSProgram"
                                                            DataTextField="ProgDesc" DataValueField="ProgNO" SelectedValue='<%#  Bind( "ProgNO") %>'
                                                            DefaultChoosedItem="ChooseOne" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtProjectNo" Text="<%$ Resources:MainGrid, ProjectNo %>" runat="server"></asp:Label></td>
                                                    <td>
                                                        <uc1:WebUserControl ID="WUCProj" IsRequired="false" runat="server" DataSourceId="ODSProject"
                                                            DataTextField="ProjDesc" DataValueField="ProjectNO" SelectedValue='<%# Bind( "ProjectNO") %>'
                                                            DefaultChoosedItem="ChooseOne" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtItemNo" Text="<%$ Resources:MainGrid, ItemNo %>" runat="server"></asp:Label></td>
                                                    <td>
                                                        <uc1:WebUserControl ID="WUCItem" runat="server" DataSourceId="ODSItem" DataTextField="ItemName"
                                                            DataValueField="ItemNo" SelectedValue='<%# Bind( "ItemNo") %>' DefaultChoosedItem="ChooseOne"
                                                            IsRequired ="False"  AutoPostBack="true" OnSelectedIndexChanged="FillAvailableAmount" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtItemDesc" Text="<%$ Resources:MainGrid, ItemDesc %>" runat="server"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <telerik:RadTextBox ID="rtxtEdtItemDesc" runat="server" SkinID="Text" Text='<%# Bind( "ItemDesc") %>' />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtUnitNo" Text="<%$ Resources:MainGrid, UnitNo %>" runat="server"></asp:Label></td>
                                                    <td>
                                                        <uc1:WebUserControl ID="WUCUnit" IsRequired="False" runat="server" DataTextField="UnitDesc"
                                                            DataValueField="UnitNo" SelectedValue='<%# Bind( "UnitNo") %>' DefaultChoosedItem="ChooseOne"
                                                            ValidationGroup="AddRow" DataSourceId="ODSUnit" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label1" Text="<%$ Resources:MainGrid, Note %>" runat="server"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadTextBox ID="rtxtEdtNote" runat="server" Text='<%# Bind( "Note") %>' Skin="WebBlue"
                                                            TextMode="MultiLine" Width="300px" SkinID="Text">
                                                        </telerik:RadTextBox>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                        <td style="width: 350px">
                                            <table id="Table4" cellspacing="1" cellpadding="1" width="350" border="0" class="module">
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblQty" Text="<%$ Resources:MainGrid, Qty %>" runat="server"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="rntxtEdtQty" runat="server" MaxLength="7" Width="90px"
                                                            ValidationGroup="AddRow" DbValue='<%# Bind( "Qty") %>'>
                                                            <NumberFormat DecimalDigits="0" GroupSeparator="," NegativePattern="-n" PositivePattern="n" />
                                                        </telerik:RadNumericTextBox>
                                                        <asp:RequiredFieldValidator ID="rfvrntxtEdtQty" runat="server" ControlToValidate="rntxtEdtQty"
                                                            ErrorMessage="<%$ Resources:Controls, RequiredValidationText %>" ValidationGroup="AddRow"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtAmountDisburse" Text="<%$ Resources:MainGrid, AmountDisburse %>"
                                                            runat="server"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="rntxtEdtAmountDisburse" runat="server" MaxLength="7"
                                                            Width="90px" DbValue='<%# Bind( "AmountDisburse") %>' >
                                                            <NumberFormat DecimalDigits="0" GroupSeparator="," NegativePattern="-n" PositivePattern="n" />
                                                        </telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtAmountRemains" Text="<%$ Resources:MainGrid, AmountRemains %>"
                                                            Visible="false" runat="server"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="rntxtEdtAmountRemains" Enabled="false" Visible="false"
                                                            EmptyMessage="0" runat="server" MaxLength="7" Width="90px">
                                                            <NumberFormat DecimalDigits="0" GroupSeparator="," NegativePattern="-n" PositivePattern="n" />
                                                        </telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtAvalAmount" Text="<%$ Resources:MainGrid, AvalAmount %>" runat="server"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="rntxtEdtAvalAmount" ReadOnly="true" EmptyMessage="0"
                                                            runat="server" MaxLength="10" Width="90px" DbValue='<%# Bind( "AvalAmount") %>'>
                                                            <NumberFormat DecimalDigits="0" GroupSeparator="," NegativePattern="-n" PositivePattern="n" />
                                                        </telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtAmountPurchase" Text="<%$ Resources:MainGrid, AmountPurchase %>"
                                                            runat="server"></asp:Label></td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="rntxtEdtAmountPurchase" runat="server" MaxLength="7"
                                                            Width="90px" DbValue='<%# Bind( "AmountPurchase") %>'>
                                                            <NumberFormat DecimalDigits="0" GroupSeparator="," NegativePattern="-n" PositivePattern="n"  />
                                                        </telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblEdtIsComplete" Text="<%$ Resources:MainGrid, IsComplete %>" runat="server"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:CheckBox runat="server" ID="chkEdtIsComplete" Checked='<%# Bind( "IsComplete") %>' />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:ImageButton ID="imgbtnEdtInsert" runat="server" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "True", "False") %>'
                                                CommandName="PerformInsert" ImageUrl="<%$ Resources:Controls, btnAddRow %>" ToolTip="AddRow"
                                                ValidationGroup="AddRow" OnClick ="CheckItemNoOrItemDesc" />
                                            <asp:ImageButton ID="imgbtnEdtUpdate" runat="server" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>'
                                                CommandName="Update" ImageUrl="<%$ Resources:Controls, btnUpdate %>" ToolTip="Update"
                                                ValidationGroup="AddRow" OnClick ="CheckItemNoOrItemDesc" />
                                            <asp:ImageButton ID="imgbtnEdtCancel" runat="server" CommandName="Cancel" ImageUrl="<%$ Resources:Controls, btnBack %>"
                                                CausesValidation="False" ToolTip="Back" />
                                        </td>
                                    </tr>
                                </table>
                            </FormTemplate>
                            <EditColumn UniqueName="EditCommandColumn1">
                            </EditColumn>
                        </EditFormSettings>
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline="False" HorizontalAlign="Center" Wrap="True"   />
                    </MasterTableView>
                    <ClientSettings AllowDragToGroup="False">
                        <Scrolling AllowScroll="True" ScrollHeight="400px"   />
                        <Selecting AllowRowSelect="True" />
                    </ClientSettings>
                    <FilterMenu EnableTheming="True" Skin="WebBlue">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </FilterMenu>
                </telerik:RadGrid>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td colspan="4">
                <sds:SessionDataSource ID="SessionDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnStrAccounting %>"
                    SelectCommand="Select IDNO,TransYear, OrderNo, ProgNO, ProjectNO, ItemNo,itemDesc, UnitNo , ISNULL(Qty, 0) AS Qty, ISNULL(AmountDisburse, 0)AS AmountDisburse, 0 AS AmountRemains, IsComplete,ISNULL( AvalAmount,0) AS AvalAmount , ISNULL(AmountPurchase, 0)  AS AmountPurchase, Note FROM         OrderItemDtl WHERE     (TransYear = @TransYear) AND (OrderNo =@OrderNo)"
                    DeleteCommand="DELETE FROM [OrderItemDtl] WHERE [IDNO] = ?" InsertCommand="INSERT INTO OrderItemDtl(TransYear, OrderNo,ProgNO, ProjectNO,ItemNo,ItemDesc, UnitNo, Qty, AmountDisburse,AmountRemains,IsComplete,AvalAmount,AmountPurchase,Note) VALUES ( @TransYear,@OrderNo,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
                    UpdateCommand="UPDATE [OrderItemDtl] SET [TransYear] = @TransYear, [OrderNo] = @OrderNo,[ProgNO] = ?, [ProjectNO] = ?, [ItemNo] = ?,[ItemDesc] = ?, [UnitNo] = ?, [Qty] = ?, [AmountDisburse] = ?, [AmountRemains] = ?, [IsComplete] = ?, [AvalAmount] = ? WHERE [TransYear] =  @TransYear And [OrderNo] = @OrderNo And [IDNO] = ? AND  [ProgNO] = ? And [ProjectNO] = ? And [ItemNo] = ? And [ItemDesc] = ?  And [UnitNo] = ? And [Qty] = ? And [AmountDisburse] = ? And [AmountRemains] = ? And [IsComplete] = ? And [AvalAmount] = ?"
                    PrimaryKeyFields="IDNO" OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues"
                    ClearSessionOnInitialLoad="True" SessionKey="System.Web.UI.Page_SessionDataSource1">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="hdnYear" Name="TransYear" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hdnID" Name="OrderNo" PropertyName="Value" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:ControlParameter ControlID="hdnYear" Name="TransYear" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hdnID" Name="OrderNo" PropertyName="Value" Type="String" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:ControlParameter ControlID="hdnYear" Name="TransYear" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hdnID" Name="OrderNo" PropertyName="Value" Type="String" />
                    </InsertParameters>
                </sds:SessionDataSource>
                <asp:ObjectDataSource ID="ODSUnit" runat="server" SelectMethod="QueryDatabase" TypeName="CL_ORM.DBWFRetrieveSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RetrieveUnit" Name="Operation" Type="String" />
                        <asp:Parameter Name="CostCenterNo" Type="String" />
                        <asp:Parameter Name="ProgramNO" Type="String" />
                        <asp:Parameter Name="ProjectNO" Type="String" />
                        <asp:Parameter Name="lEVEL" Type="String" />
                        <asp:ControlParameter ControlID="hdnItemNo" Name="ItemNo" PropertyName="Value" Type="String" />
                        <asp:Parameter Name="FParmeter" Type="String" />
                        <asp:Parameter Name="SParmeter" Type="String" />
                        <asp:Parameter Name="TParmeter" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ODSAllUnits" runat="server" SelectMethod="QueryDatabase"
                    TypeName="CL_ORM.DBWFRetrieveSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RetrieveAllUnits" Name="Operation" Type="String" />
                        <asp:Parameter Name="CostCenterNo" Type="String" />
                        <asp:Parameter Name="ProgramNO" Type="String" />
                        <asp:Parameter Name="ProjectNO" Type="String" />
                        <asp:Parameter Name="lEVEL" Type="String" />
                        <asp:Parameter Name="ItemNo" Type="String" />
                        <asp:Parameter Name="FParmeter" Type="String" />
                        <asp:Parameter Name="SParmeter" Type="String" />
                        <asp:Parameter Name="TParmeter" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ODSItem" runat="server" SelectMethod="QueryDatabase" TypeName="CL_ORM.DBWFRetrieveSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RetrieveItem" Name="Operation" Type="String" />
                        <asp:Parameter Name="CostCenterNo" Type="String" />
                        <asp:Parameter Name="ProgramNO" Type="String" />
                        <asp:Parameter Name="ProjectNO" Type="String" />
                        <asp:Parameter Name="lEVEL" Type="String" />
                        <asp:Parameter Name="ItemNo" Type="String" />
                        <asp:Parameter Name="FParmeter" Type="String" />
                        <asp:Parameter Name="SParmeter" Type="String" />
                        <asp:Parameter Name="TParmeter" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ODSProject" runat="server" SelectMethod="QueryDatabase"
                    TypeName="CL_ORM.DBWFRetrieveSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RetrieveProject" Name="Operation" Type="String" />
                        <asp:Parameter Name="CostCenterNo" Type="String" />
                        <asp:Parameter Name="ProgramNO" Type="String" />
                        <asp:Parameter Name="ProjectNO" Type="String" />
                        <asp:Parameter Name="lEVEL" Type="String" />
                        <asp:Parameter Name="ItemNo" Type="String" />
                        <asp:Parameter Name="FParmeter" Type="String" />
                        <asp:Parameter Name="SParmeter" Type="String" />
                        <asp:Parameter Name="TParmeter" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ODSProgram" runat="server" SelectMethod="QueryDatabase"
                    TypeName="CL_ORM.DBWFRetrieveSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RetrieveProgram" Name="Operation" Type="String" />
                        <asp:Parameter Name="CostCenterNo" Type="String" />
                        <asp:Parameter Name="ProgramNO" Type="String" />
                        <asp:Parameter Name="ProjectNO" Type="String" />
                        <asp:Parameter Name="lEVEL" Type="String" />
                        <asp:Parameter Name="ItemNo" Type="String" />
                        <asp:Parameter Name="FParmeter" Type="String" />
                        <asp:Parameter Name="SParmeter" Type="String" />
                        <asp:Parameter Name="TParmeter" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:RadioButtonList ID="rblActions" runat="server" DataSourceID="DSActions" DataTextField="DescriptionAR"
                    DataValueField="ActionId" meta:resourcekey="rblActions">
                </asp:RadioButtonList><asp:ObjectDataSource ID="DSActions" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="QueryDatabase" TypeName="CL_ORM.DB_Process_Process_ActionsSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="ProcessAction" Name="Operation" Type="String" />
                        <asp:Parameter DefaultValue="MaterialRequest" Name="Scr_Code" Type="String" />
                        <asp:Parameter DefaultValue="" Name="ActionId" Type="String" />
                        <asp:ControlParameter ControlID="hdnStepParam" Name="Process_Number" PropertyName="Value"
                            Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblNote" runat="server" Font-Bold="False" meta:resourcekey="lblNote"></asp:Label></td>
            <td colspan="4">
                <telerik:RadTextBox ID="rtxtNotes" runat="server" Height="70px" Skin="WebBlue" TextMode="MultiLine"
                    Width="500px" SkinID="Text">
                </telerik:RadTextBox></td>
        </tr>
        <tr>
            <td>
            </td>
            <td colspan="4">
                <telerik:RadGrid ID="rgNotes" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    GridLines="None" MasterTableView-Dir="<%$ Resources:SystemResource, HTMLDirectionality %>"
                    Skin="WebBlue" SortingSettings-SortToolTip="<%$ Resources:Grid ,SortToolTip %>"
                    DataSourceID="ODSNotes">
                    <MasterTableView DataKeyNames="NoteID" NoMasterRecordsText="<%$ Resources:Grid , NoMasterRecordsText %>"
                        TableLayout="Fixed" DataSourceID="ODSNotes">
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="UserName" HeaderText="<%$ Resources:NotesGrid, UserName %>"
                                UniqueName="UserName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Managment" HeaderText="<%$ Resources:NotesGrid, Management %>"
                                UniqueName="Management">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Note" HeaderText="<%$ Resources:NotesGrid, Notes %>"
                                UniqueName="Notes">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ActionDescAr" HeaderText="<%$ Resources:NotesGrid, ActionDescription %>"
                                UniqueName="ActionDescription">
                            </telerik:GridBoundColumn>
                            <telerik:GridDateTimeColumn DataField="NoteDate" DataFormatString="{0:dd/MM/yy}"
                                HeaderText="<%$ Resources:NotesGrid, NoteDate %>" UniqueName="NoteDate">
                            </telerik:GridDateTimeColumn>
                            <telerik:GridDateTimeColumn DataField="NoteDate" DataFormatString="{0:hh:mm}" HeaderText="<%$ Resources:NotesGrid, NoteTime %>"
                                UniqueName="NoteTime">
                            </telerik:GridDateTimeColumn>
                        </Columns>
                        <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline="False" Wrap="True" />
                        <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline="False" Wrap="True" HorizontalAlign="Center" />
                    </MasterTableView>
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                        <Scrolling ScrollHeight="" UseStaticHeaders="True" />
                    </ClientSettings>
                    <FilterMenu EnableAjaxSkinRendering="False" EnableEmbeddedBaseStylesheet="False"
                        EnableEmbeddedSkins="False" EnableTheming="True" Skin="Red">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </FilterMenu>
                    <SortingSettings SortToolTip="Click here to Sort" />
                </telerik:RadGrid>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="5">
                <asp:ObjectDataSource ID="ODSNotes" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="QueryDatabase" TypeName="CL_ORM.DB_Process_NotesSP">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                        <asp:Parameter DefaultValue="RetrieveAllNotes" Name="Operation" Type="String" />
                        <asp:ControlParameter ControlID="hdnID" DefaultValue="" Name="ID" PropertyName="Value"
                            Type="String" />
                        <asp:ControlParameter ControlID="hdnYear" DefaultValue="" Name="Year" PropertyName="Value"
                            Type="String" />
                        <asp:Parameter Name="NoteDate" Type="String" />
                        <asp:Parameter Name="NoteTime" Type="String" />
                        <asp:Parameter DefaultValue="" Name="NoteID" Type="String" />
                        <asp:Parameter DefaultValue="MaterialRequest" Name="Scr_Code" Type="String" />
                        <asp:Parameter Name="UserName" Type="String" />
                        <asp:Parameter Name="Managment" Type="String" />
                        <asp:Parameter Name="Note" Type="String" />
                        <asp:Parameter Name="ActionId" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:HiddenField ID="hdnID" runat="server" />
                <asp:HiddenField ID="hdnStepParam" runat="server" />
                <asp:HiddenField ID="hdnUserID" runat="server" />
                <asp:HiddenField ID="hdnUserName" runat="server" />
                <asp:HiddenField ID="hdnEmp_No" runat="server" />
                <asp:HiddenField ID="hdnDep" runat="server" />
                <asp:HiddenField ID="hdnMang" runat="server" />
                <asp:HiddenField ID="hdnSec" runat="server" />
                <asp:HiddenField ID="hdnDepNo" runat="server" />
                <asp:HiddenField ID="hdnMangNo" runat="server" />
                <asp:HiddenField ID="hdnSecNo" runat="server" />
                <asp:HiddenField ID="hdnCurrentEmpSectionNo" runat="server" />
                <asp:HiddenField ID="hdnYear" runat="server" />
                <asp:HiddenField ID="hdnchk" runat="server" />
                <asp:HiddenField ID="hdnEmp_DepNo" runat="server" />
                <asp:HiddenField ID="hdnAvailableAmount" runat="server" />
                <asp:HiddenField ID="hdnUnitDataSource" runat="server" />
                <asp:HiddenField ID="hdnItemNo" runat="server" />
                 <asp:HiddenField ID="hdnItemDesc" runat="server" />
                         <asp:HiddenField ID="hdnchkItemNoOrItemDesc" runat="server" />
                <asp:HiddenField ID="hdnScript" runat="server" />
            </td>
        </tr>
        <tr>
            <td align="center" colspan="5">
                <asp:ImageButton ID="btnBack" runat="server" ImageUrl="<%$ Resources:Controls, btnBack %>"
                    ToolTip="Back" Visible="False" />
                <asp:ImageButton ID="btnPrint" runat="server" ImageUrl="<%$ Resources:Controls, btnPrint %>"
                    ToolTip="Print" Visible="False" />
                <asp:ImageButton ID="btnSend" runat="server" ImageUrl="<%$ Resources:controls, btnSend %>"
                    ToolTip="Send" ValidationGroup="Submit" /></td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
    </table>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgMat">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgMat" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadWindow ID="RadWindow1" runat="server">
    </telerik:RadWindow>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" IsSticky="false">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0px;" />
    </telerik:RadAjaxLoadingPanel>
</asp:Content>
